
swap.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <swap>:
#include <stdio.h>

void swap(int u, int v)
{
   0:	e92d4800 	push	{fp, lr}
   4:	e28db004 	add	fp, sp, #4
   8:	e24dd010 	sub	sp, sp, #16
   c:	e50b0010 	str	r0, [fp, #-16]
  10:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
	int temp;
	
	printf("u = %d v = %d\n", u, v);
  14:	e51b2014 	ldr	r2, [fp, #-20]	; 0xffffffec
  18:	e51b1010 	ldr	r1, [fp, #-16]
  1c:	e59f0030 	ldr	r0, [pc, #48]	; 54 <swap+0x54>
  20:	ebfffffe 	bl	0 <printf>
	temp = u;
  24:	e51b3010 	ldr	r3, [fp, #-16]
  28:	e50b3008 	str	r3, [fp, #-8]
	u = v;
  2c:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
  30:	e50b3010 	str	r3, [fp, #-16]
	v = temp;
  34:	e51b3008 	ldr	r3, [fp, #-8]
  38:	e50b3014 	str	r3, [fp, #-20]	; 0xffffffec
	printf("u = %d v = %d\n", u, v);
  3c:	e51b2014 	ldr	r2, [fp, #-20]	; 0xffffffec
  40:	e51b1010 	ldr	r1, [fp, #-16]
  44:	e59f0008 	ldr	r0, [pc, #8]	; 54 <swap+0x54>
  48:	ebfffffe 	bl	0 <printf>
}
  4c:	e24bd004 	sub	sp, fp, #4
  50:	e8bd8800 	pop	{fp, pc}
  54:	00000000 	.word	0x00000000

00000058 <errswap>:

void errswap(int *a, int *b)
{
  58:	e52db004 	push	{fp}		; (str fp, [sp, #-4]!)
  5c:	e28db000 	add	fp, sp, #0
  60:	e24dd014 	sub	sp, sp, #20
  64:	e50b0010 	str	r0, [fp, #-16]
  68:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
	int *temp;

	temp = NULL;
  6c:	e3a03000 	mov	r3, #0
  70:	e50b3008 	str	r3, [fp, #-8]
	temp = a;
  74:	e51b3010 	ldr	r3, [fp, #-16]
  78:	e50b3008 	str	r3, [fp, #-8]
	a = b;
  7c:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
  80:	e50b3010 	str	r3, [fp, #-16]
	b = temp;
  84:	e51b3008 	ldr	r3, [fp, #-8]
  88:	e50b3014 	str	r3, [fp, #-20]	; 0xffffffec
}
  8c:	e24bd000 	sub	sp, fp, #0
  90:	e49db004 	pop	{fp}		; (ldr fp, [sp], #4)
  94:	e12fff1e 	bx	lr

00000098 <pswap>:

void pswap(int *u, int *v)
{
  98:	e52db004 	push	{fp}		; (str fp, [sp, #-4]!)
  9c:	e28db000 	add	fp, sp, #0
  a0:	e24dd014 	sub	sp, sp, #20
  a4:	e50b0010 	str	r0, [fp, #-16]
  a8:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
	int temp;
	
	//printf("u = %d v = %d\n", &u, &v);
	temp = *u;
  ac:	e51b3010 	ldr	r3, [fp, #-16]
  b0:	e5933000 	ldr	r3, [r3]
  b4:	e50b3008 	str	r3, [fp, #-8]
	*u = *v;
  b8:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
  bc:	e5932000 	ldr	r2, [r3]
  c0:	e51b3010 	ldr	r3, [fp, #-16]
  c4:	e5832000 	str	r2, [r3]
	*v = temp;
  c8:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
  cc:	e51b2008 	ldr	r2, [fp, #-8]
  d0:	e5832000 	str	r2, [r3]
	//printf("u = %d v = %d\n", &u, &v);
}
  d4:	e24bd000 	sub	sp, fp, #0
  d8:	e49db004 	pop	{fp}		; (ldr fp, [sp], #4)
  dc:	e12fff1e 	bx	lr

000000e0 <ppswap>:

void ppswap(int **a, int **b)
{
  e0:	e52db004 	push	{fp}		; (str fp, [sp, #-4]!)
  e4:	e28db000 	add	fp, sp, #0
  e8:	e24dd014 	sub	sp, sp, #20
  ec:	e50b0010 	str	r0, [fp, #-16]
  f0:	e50b1014 	str	r1, [fp, #-20]	; 0xffffffec
	int *tmp = NULL;
  f4:	e3a03000 	mov	r3, #0
  f8:	e50b3008 	str	r3, [fp, #-8]

	tmp = *a;
  fc:	e51b3010 	ldr	r3, [fp, #-16]
 100:	e5933000 	ldr	r3, [r3]
 104:	e50b3008 	str	r3, [fp, #-8]
	*a = *b;
 108:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
 10c:	e5932000 	ldr	r2, [r3]
 110:	e51b3010 	ldr	r3, [fp, #-16]
 114:	e5832000 	str	r2, [r3]
	*b = tmp;
 118:	e51b3014 	ldr	r3, [fp, #-20]	; 0xffffffec
 11c:	e51b2008 	ldr	r2, [fp, #-8]
 120:	e5832000 	str	r2, [r3]
}
 124:	e24bd000 	sub	sp, fp, #0
 128:	e49db004 	pop	{fp}		; (ldr fp, [sp], #4)
 12c:	e12fff1e 	bx	lr

00000130 <main>:
	  printf("a = %d b = %d\n", (a), (b));	\
	} while (--__size > 0);						      \
    } while (0)

int main()
{
 130:	e92d4870 	push	{r4, r5, r6, fp, lr}
 134:	e28db010 	add	fp, sp, #16
 138:	e24dd01c 	sub	sp, sp, #28
	int a = 3, b = 4;
 13c:	e3a03003 	mov	r3, #3
 140:	e50b301c 	str	r3, [fp, #-28]	; 0xffffffe4
 144:	e3a03004 	mov	r3, #4
 148:	e50b3020 	str	r3, [fp, #-32]	; 0xffffffe0
	int *pa = &a, *pb = &b;
 14c:	e24b301c 	sub	r3, fp, #28
 150:	e50b3024 	str	r3, [fp, #-36]	; 0xffffffdc
 154:	e24b3020 	sub	r3, fp, #32
 158:	e50b3028 	str	r3, [fp, #-40]	; 0xffffffd8

	swap(a, b);
 15c:	e51b301c 	ldr	r3, [fp, #-28]	; 0xffffffe4
 160:	e51b2020 	ldr	r2, [fp, #-32]	; 0xffffffe0
 164:	e1a01002 	mov	r1, r2
 168:	e1a00003 	mov	r0, r3
 16c:	ebfffffe 	bl	0 <swap>
	printf("swap : a = %d b = %d\n", a, b);	// 3	4
 170:	e51b301c 	ldr	r3, [fp, #-28]	; 0xffffffe4
 174:	e51b2020 	ldr	r2, [fp, #-32]	; 0xffffffe0
 178:	e1a01003 	mov	r1, r3
 17c:	e59f00f0 	ldr	r0, [pc, #240]	; 274 <main+0x144>
 180:	ebfffffe 	bl	0 <printf>

	errswap(&a, &b);
 184:	e24b2020 	sub	r2, fp, #32
 188:	e24b301c 	sub	r3, fp, #28
 18c:	e1a01002 	mov	r1, r2
 190:	e1a00003 	mov	r0, r3
 194:	ebfffffe 	bl	58 <errswap>
	printf("errswap : a = %d b = %d\n", a, b);	// 3	4
 198:	e51b301c 	ldr	r3, [fp, #-28]	; 0xffffffe4
 19c:	e51b2020 	ldr	r2, [fp, #-32]	; 0xffffffe0
 1a0:	e1a01003 	mov	r1, r3
 1a4:	e59f00cc 	ldr	r0, [pc, #204]	; 278 <main+0x148>
 1a8:	ebfffffe 	bl	0 <printf>
	
	pswap(&a, &b);
 1ac:	e24b2020 	sub	r2, fp, #32
 1b0:	e24b301c 	sub	r3, fp, #28
 1b4:	e1a01002 	mov	r1, r2
 1b8:	e1a00003 	mov	r0, r3
 1bc:	ebfffffe 	bl	98 <pswap>
	printf("a = %d b = %d\n", a, b);	// 4	3
 1c0:	e51b301c 	ldr	r3, [fp, #-28]	; 0xffffffe4
 1c4:	e51b2020 	ldr	r2, [fp, #-32]	; 0xffffffe0
 1c8:	e1a01003 	mov	r1, r3
 1cc:	e59f00a8 	ldr	r0, [pc, #168]	; 27c <main+0x14c>
 1d0:	ebfffffe 	bl	0 <printf>

	ppswap(&pa, &pb);
 1d4:	e24b2028 	sub	r2, fp, #40	; 0x28
 1d8:	e24b3024 	sub	r3, fp, #36	; 0x24
 1dc:	e1a01002 	mov	r1, r2
 1e0:	e1a00003 	mov	r0, r3
 1e4:	ebfffffe 	bl	e0 <ppswap>
	printf("a = %d b = %d\n", a, b);	// 4	3
 1e8:	e51b301c 	ldr	r3, [fp, #-28]	; 0xffffffe4
 1ec:	e51b2020 	ldr	r2, [fp, #-32]	; 0xffffffe0
 1f0:	e1a01003 	mov	r1, r3
 1f4:	e59f0080 	ldr	r0, [pc, #128]	; 27c <main+0x14c>
 1f8:	ebfffffe 	bl	0 <printf>

	SWAP(pa,pb,3);
 1fc:	e3a04003 	mov	r4, #3
 200:	e51b6024 	ldr	r6, [fp, #-36]	; 0xffffffdc
 204:	e51b5028 	ldr	r5, [fp, #-40]	; 0xffffffd8
 208:	e5d63000 	ldrb	r3, [r6]
 20c:	e54b3015 	strb	r3, [fp, #-21]	; 0xffffffeb
 210:	e51b3024 	ldr	r3, [fp, #-36]	; 0xffffffdc
 214:	e51b2028 	ldr	r2, [fp, #-40]	; 0xffffffd8
 218:	e1a01003 	mov	r1, r3
 21c:	e59f0058 	ldr	r0, [pc, #88]	; 27c <main+0x14c>
 220:	ebfffffe 	bl	0 <printf>
 224:	e1a03006 	mov	r3, r6
 228:	e2836001 	add	r6, r3, #1
 22c:	e5d52000 	ldrb	r2, [r5]
 230:	e5c32000 	strb	r2, [r3]
 234:	e1a03005 	mov	r3, r5
 238:	e2835001 	add	r5, r3, #1
 23c:	e55b2015 	ldrb	r2, [fp, #-21]	; 0xffffffeb
 240:	e5c32000 	strb	r2, [r3]
 244:	e51b3024 	ldr	r3, [fp, #-36]	; 0xffffffdc
 248:	e51b2028 	ldr	r2, [fp, #-40]	; 0xffffffd8
 24c:	e1a01003 	mov	r1, r3
 250:	e59f0024 	ldr	r0, [pc, #36]	; 27c <main+0x14c>
 254:	ebfffffe 	bl	0 <printf>
 258:	e2444001 	sub	r4, r4, #1
 25c:	e3540000 	cmp	r4, #0
 260:	1affffe8 	bne	208 <main+0xd8>
	
	return 0;
 264:	e3a03000 	mov	r3, #0
}
 268:	e1a00003 	mov	r0, r3
 26c:	e24bd010 	sub	sp, fp, #16
 270:	e8bd8870 	pop	{r4, r5, r6, fp, pc}
 274:	00000010 	.word	0x00000010
 278:	00000028 	.word	0x00000028
 27c:	00000044 	.word	0x00000044
